import React, { useState, useRef } from "react";

export default function App() {
  const [count, setCount] = useState(0);
  //useRef对闭包的使用
  //
  const myCount = useRef(22);
  return (
    <div>
      App
      <button
        onClick={() => {
          setCount(count + 1);
          myCount.current++;
        }}
      >
        点击增加
      </button>
      {count}-{myCount.current}
    </div>
  );
}
